package
{
	import com.bit101.components.Component;
	import com.bit101.components.Panel;
	import com.bit101.components.PushButton;
	
	import component.LContainer;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	import models.ModelLocator;
	
	import utils.Coursor;
	
	import view.AccordianMotion;
	import view.CanvasFrame;
	import view.EditFrame;
	import view.LoadingSprite;
	import view.PricePanle;
	import view.SizeShow;
	import view.SubmitAlert;
	
	[SWF(height="470",width="950",backgroundColor="#f3eddf")]
	public class CanvasEdit extends Sprite
	{
		private var sizeShow:SizeShow;
		private var canvasframe:CanvasFrame;
		private var editframe:EditFrame;
		public var container:AccordianMotion;
		private var pricepanle:PricePanle;
		private var model:ModelLocator = ModelLocator.getInstance();
		private var coursor:Coursor = Coursor.getInstance();
		private var submitAlert:SubmitAlert;
		public function CanvasEdit()
		{
			var loading:LoadingSprite = new LoadingSprite;
			this.addChild(loading);
			loading.addEventListener("loadcom",init);
			//init();
		}
		public function showSize(id:int=0):void{
			if(id == 0){
				canvasframe.remove();
				editframe.remove()
				this.addChild(sizeShow);
				sizeShow.x = 173;
				sizeShow.y = 4;
			}else if(id == 1){
				sizeShow.remove();
				editframe.remove();
				this.addChild(canvasframe);
				canvasframe.x = 173;
				canvasframe.y = 4;
			}else{
				sizeShow.remove();
				canvasframe.remove();
				this.addChild(editframe);
				editframe.show(model.selectData)
				editframe.x = 173;
				editframe.y = 4;
			}
		}
		private function init(event:Event):void{
			this.removeChild(event.target as Sprite);
			this.graphics.beginFill(0xffffff);
			this.graphics.drawRect(0,0,950,470);
			this.graphics.endFill();
			coursor.container = this;
			sizeShow = SizeShow.getInstance();
			canvasframe = CanvasFrame.getInstance();
			editframe = EditFrame.getInstance();
			container = new AccordianMotion(this,5,2);
			pricepanle = PricePanle.getInstance();
			pricepanle.x = 172;
			pricepanle.y = 405;
			this.addChild(pricepanle);
			submitAlert = SubmitAlert.getInstance();
			submitAlert.container = this;
		}
	}
}